x86/vpmu_intel: fix hypervisor crash by masking PC bit in MSR_P6_EVNTSEL
authorMohit Gambhir <mohit.gambhir@oracle.com>
Mon, 8 May 2017 11:37:17 +0000 (13:37 +0200)
committerJan Beulich <jbeulich@suse.com>
Mon, 8 May 2017 11:37:17 +0000 (13:37 +0200)
commit8bf68dca65e2d61f4dfc6715cca51ad3dd5aadf1
treee128b942033070e443f1f5e43415ed6f02af63d2
parentd595e126c96976d056d7877e4319b3f2f3d246b1
x86/vpmu_intel: fix hypervisor crash by masking PC bit in MSR_P6_EVNTSEL

Setting Pin Control (PC) bit (19) in MSR_P6_EVNTSEL results in a General
Protection Fault and thus results in a hypervisor crash. This behavior has
been observed on two generations of Intel processors namely, Haswell and
Broadwell. Other Intel processor generations were not tested. However, it
does seem to be a possible erratum that hasn't yet been confirmed by Intel.

To fix the problem this patch masks PC bit and returns an error in
case any guest tries to write to it on any Intel processor. In addition
to the fact that setting this bit crashes the hypervisor on Haswell and
Broadwell, the PC flag bit toggles a hardware pin on the physical CPU
every time the programmed event occurs and the hardware behavior in
response to the toggle is undefined in the SDM, which makes this bit
unsafe to be used by guests and hence should be masked on all machines.

Signed-off-by: Mohit Gambhir <mohit.gambhir@oracle.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Kevin Tian <kevin.tian@intel.com>
Release-acked-by: Julien Grall <julien.grall@arm.com>
xen/arch/x86/cpu/vpmu_intel.c